/* 文件上传
 * FileApi.js
 */
import {REQUEST_URL} from './Constants';
import {postFormData,getData,uploadFiles} from './HttpUtil';


//音频上传
export function uploadAudio(files,category_id){
	return uploadFiles(REQUEST_URL.UPLOAD_AUDIO_URL,files,{category_id:category_id})
	.then(res=>{
		return res;
	},err=>{
		console.log('file api uploadImg error');
		console.log(err);
	});
}

//获取音频列表
export function audioList(params={}){
	return getData(REQUEST_URL.AUDIO_LIST_URL,params)
	.then(res=>{
		return res;
	},err=>{
		console.log('file api imglist error');
		console.log(err);
	});
}

//获取音频分类列表
export function audioCategoryList(){
	return getData(REQUEST_URL.AUDIO_CATEGORY_URL)
	.then(res=>{
		return res;
	},err=>{
		console.log('file api imglist error');
		console.log(err);
	});
}

//文件上传
export function uploadFile(files,category_id){
	return uploadFiles(REQUEST_URL.UPLOAD_FILE_URL,files,{category_id:category_id})
	.then(res=>{
		return res;
	},err=>{
		console.log('file api uploadImg error');
		console.log(err);
	});
}

//获取文件列表
export function fileList(params={}){
	return getData(REQUEST_URL.FILE_LIST_URL,params)
	.then(res=>{
		return res;
	},err=>{
		console.log('file api imglist error');
		console.log(err);
	});
}

//获取文件分类列表
export function fileCategoryList(){
	return getData(REQUEST_URL.FILE_CATEGORY_URL)
	.then(res=>{
		return res;
	},err=>{
		console.log('file api imglist error');
		console.log(err);
	});
}